<template>
	<div id="WinningRate">
		<div id="header">
			<img @click="$router.go(-1)" src="../../static/img/return.png"/>
			<p>我的中奖率PK</p>
		</div>
		<div class="winning_1">
			<img src="../../static/img/WinningRate-08.png"/>
			<p>以下任何一项权重偏低，都会影响你的中奖率哦~</p>
		</div>
		<ul class="winning_2">
			<li>
				<div class="winning_left">
					<img src="../../static/img/WinningRate-01.png"/>
					<div>
						<p>试用完成率：（下单数/中奖率）{{parseInt(rate.finishRate*100)}}%</p>
						<div class="progress_bar">
							<div :style="{width:finishRate}"></div>
						</div>
					</div>
				</div>
				<router-link to="/home/good">立即申请</router-link>
			</li>
			<li>
				<div class="winning_left">
					<img src="../../static/img/WinningRate-02.png"/>
					<div>
						<p>7天内首次申请数：{{rate.firstApply}}，低于{{parseInt(rate.firstApplyRate*100)}}%的用户</p>
						<div class="progress_bar">
							<div :style="{width:firstApplyRate}"></div>
						</div>
					</div>
				</div>
				<router-link to="/home/good">立即申请</router-link>
			</li>
			<li>
				<div class="winning_left">
					<img src="../../static/img/WinningRate-03.png"/>
					<div>
						<p>7天内申请天数：{{rate.applyNum}}，低于{{parseInt(rate.applyNumRate*100)}}%的用户</p>
						<div class="progress_bar">
							<div :style="{width:applyNumRate}"></div>
						</div>
					</div>
				</div>
				<router-link to="/home/good">立即申请</router-link>
			</li>
			<li>
				<div class="winning_left">
					<img src="../../static/img/WinningRate-04.png"/>
					<div>
						<p>7天内继续抽奖数：{{rate.continueApply}}，低于{{parseInt(rate.continueApplyRate*100)}}%的用户</p>
						<div class="progress_bar">
							<div :style="{width:continueApplyRate}"></div>
						</div>
					</div>
				</div>
				<router-link to="/home/myActivity?type=3">继续抽奖</router-link>
			</li>
			<li>
				<div class="winning_left">
					<img src="../../static/img/WinningRate-05.png"/>
					<div>
						<p>是否会员：{{rate.isMember == 1?'是':'否'}}，低于{{parseInt(rate.isMemberRate*100)}}%的用户</p>
						<div class="progress_bar">
							<div :style="{width:isMemberRate}"></div>
						</div>
					</div>
				</div>
				<router-link to="/user/vip">立即开通</router-link>
			</li>
			<li>
				<div class="winning_left">
					<img src="../../static/img/WinningRate-06.png"/>
					<div>
						<p>完善资料+绑定微信+绑定QQ：{{parseInt(rate.infoRate*100)}}%</p>
						<div class="progress_bar">
							<div :style="{width:infoRate}"></div>
						</div>
					</div>
				</div>
				<router-link to="/user/account">立即完善</router-link>
			</li>
			<li>
				<div class="winning_left">
					<img src="../../static/img/WinningRate-07.png"/>
					<div>
						<p>近7日金币充值数：{{rate.recharge}}，低于{{parseInt(rate.rechargeRate*100)}}%的用户</p>
						<div class="progress_bar">
							<div :style="{width:rechargeRate}"></div>
						</div>
					</div>
				</div>
				<router-link to="/user/recharge">立即充值</router-link>
			</li>
		</ul>
	</div>
</template>

<script>
export default{
	name: 'WinningRate',
	data:function(){
		return{
			width: '30%',
			rate:{
				finishRate: 0,//试用完成率
				firstApply: 0,//7天内首次申请数
				firstApplyRate: 0,//7天内首次申请数比例
				applyNum: 0,//7天内申请天数
				applyNumRate: 0,//7天内申请天数比例
				continueApply: 0,//继续抽奖数
				continueApplyRate: 0,//继续抽奖百分比
				isMember: 0,//是否会员
				isMemberRate: 0,//会员比例
				infoRate: 0,//完善资料比例
				recharge: 0,//充值数额
				rechargeRate: 0,//充值比例
			}
		}
	},
	computed:{
		finishRate:function(){
			return this.rate.finishRate * 100 + '%'
		},
		firstApplyRate:function(){
			return (1 - this.rate.firstApplyRate)*100 + '%'
		},
		applyNumRate:function(){
			return (1 - this.rate.applyNumRate)*100 + '%'
		},
		continueApplyRate:function(){
			return (1 - this.rate.continueApplyRate)*100 + '%'
		},
		isMemberRate:function(){
			return (1 - this.rate.isMemberRate)*100 + '%'
		},
		infoRate:function(){
			return this.rate.infoRate * 100 + '%'
		},
		rechargeRate:function(){
			return (1 - this.rate.rechargeRate)*100 + '%'
		},
	},
	created:function(){
		var _this = this;
		_this.$axios.post('/user/info/getMyWinRate').then(function(res){
			var data = res.data.result;
			_this.rate = data;
		})
	}
}
</script>

<style scoped>
/* ========== */
/* = Header = */
/* ========== */
#header{
	width: 100%;
	background-color: #fff;
	position: fixed;
	top: 0;
	left: 0;
	height: 4rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-bottom: 1px solid #EEEEEE;
	font-size: 1.6rem;
	color: #4F4F4F;
	box-sizing: border-box;
	z-index: 10;
}
#header img{
	height: 2rem;
	display: block;
	position: absolute;
	top: 1rem;
	left: 2rem;
}
#WinningRate{
	height: 100%;
	padding-top: 4rem;
	box-sizing: border-box;
}
.winning_1{
	display: flex;
	align-items: center;
	height: 2.6rem;
	padding-left: 1rem;
	box-sizing: border-box;
	background-color: #FFFBDB;
	color: #F48B00;
	border-bottom: 1px solid #F7D47E;
}
.winning_1 img{
	height: 1rem;
	display: block;
	margin-right: 0.5rem;
}
.winning_2 li{
	display: flex;
	align-items: center;
	padding: 2rem 1rem;
	box-sizing: border-box;
	background-color: #fff;
	margin-bottom: 0.5rem;
}
.winning_2 li .winning_left{
	display: flex;
	align-items: center;
	width: calc(100% - 8rem);
}
.winning_2 li .winning_left img{
	height: 3rem;
	display: block;
	margin-right: 1rem;
}
.winning_2 li .winning_left>div{
	width: calc(100% - 4rem);
	font-size: 1.2rem;
	color: #4F4F4F;
}
.winning_2 li .winning_left .progress_bar{
	width: 90%;
	border: 1px solid #FF6565;
	border-radius: 50px;
	height: 0.6rem;
	box-sizing: border-box;
	overflow: hidden;
	margin-top: 0.5rem;
}
.winning_2 li .winning_left .progress_bar div{
	height: 100%;
	background-color: #FF6565;
}
.winning_2 li a{
	width: 7.5rem;
	height: 2.6rem;
	background-color: #FF6565;
	color: #FFFFFF;
	border-radius: 3px;
	text-align: center;
	line-height: 2.6rem;
	font-size: 1.2rem;
	margin-left: 0.5rem;
}

</style>
